fix: propagate OutputCheckError to caller instead of silently returning#7478
Closed
Yanhu007 wants to merge 1 commit intoagno-agi:mainfrom
Closed
fix: propagate OutputCheckError to caller instead of silently returning#7478Yanhu007 wants to merge 1 commit intoagno-agi:mainfrom
Yanhu007 wants to merge 1 commit intoagno-agi:mainfrom
Conversation
OutputCheckError raised in output_validation_post_hook is caught internally and returned as a normal RunResponse with error status. This means try/except OutputCheckError never reaches the except block, contradicting the documented usage pattern. Re-raise InputCheckError/OutputCheckError after cleanup/logging in all four non-streaming run methods: - _run (sync) - _arun (async) - _continue_run (sync continuation) - _acontinue_run (async continuation) Streaming methods (_run_stream, _arun_stream, etc.) still return the error response since exceptions can't propagate mid-stream. Fixes agno-agi#7414
Contributor
PR TriageA few things to address before this PR can be reviewed: Missing tests: This PR modifies source code but does not include any test changes. Please add or update tests to cover your changes. Possible duplicate: The following open PRs also reference the same issue(s):
If this is intentional, please explain in your PR description why this approach is preferred. Otherwise, consider collaborating on the existing PR instead. This PR has been automatically closed. There is already an open PR addressing this issue. If you believe your contribution is valuable, please comment on the original issue explaining your approach and why it might be preferred. A maintainer can reopen this PR if appropriate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7414
OutputCheckErrorraised insideoutput_validation_post_hookis caught internally by the run methods and returned as a normalRunResponsewithstatus=error. This means the documentedtry/except OutputCheckErrorpattern never works:Changes
Changed
return run_response→raisein theexcept (InputCheckError, OutputCheckError)handler of all four non-streaming run methods:_run_arun_continue_run_acontinue_runSession cleanup and error logging are preserved before the re-raise. The exception object (with
run_output,check_trigger, etc.) is propagated intact.Streaming methods (
_run_stream,_arun_stream, etc.) still return the error response since exceptions can't meaningfully propagate mid-stream iteration.